package com.symria.client.ad;

import java.util.Date;
import java.util.List;

import com.symria.framework.page.ATTPage;
import com.symria.framework.page.Page;
import com.symria.framework.page.PagerFactory;
import com.symria.framework.util.BaseAction;
import com.symria.server.bo.ad.AdService;
import com.symria.server.po.AdAppReport;
import com.symria.server.po.AdAreaReport;
import com.symria.server.po.AdCampaign;
import com.symria.server.po.SysAreaInfo;
import com.symria.server.po.UserInfo;
import com.symria.system.constants.BaseAttribute;
import com.symria.system.util.SessionHelper;

public class AdAction extends BaseAction {	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private AdService adService;
	private String viewType;
	private AdCampaign campaign;
	private Date beginDate;
	private Date endDate;
	private AdAppReport aar;
	private AdAreaReport area;
	private String adName;
	private Integer areaId;
	
	public Integer getAreaId() {
		return areaId;
	}
	public void setAreaId(Integer areaId) {
		this.areaId = areaId;
	}
	public AdAreaReport getArea() {
		return area;
	}
	public void setArea(AdAreaReport area) {
		this.area = area;
	}
	public String getAdName() {
		return adName;
	}
	public void setAdName(String adName) {
		this.adName = adName;
	}
	public AdAppReport getAar() {
		return aar;
	}
	public void setAar(AdAppReport aar) {
		this.aar = aar;
	}
	public String getViewType() {
		return viewType;
	}
	public void setViewType(String viewType) {
		this.viewType = viewType;
	}
	public AdCampaign getCampaign() {
		return campaign;
	}
	public void setCampaign(AdCampaign campaign) {
		this.campaign = campaign;
	}
	public AdService getAdService() {
		return adService;
	}
	public void setAdService(AdService adService) {
		this.adService = adService;
	}

	public Date getBeginDate() {
		return beginDate;
	}
	public void setBeginDate(Date beginDate) {
		this.beginDate = beginDate;
	}
	public Date getEndDate() {
		return endDate;
	}
	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}
	/**
	 *功能描述:
	 * 2014-3-6
	 * @return
	 * admin
	 */
	public String searchCampaign(){
		UserInfo user = SessionHelper.getUserInfo();
		Page page = PagerFactory.createPage();
		adService.searchAdCampaign(campaign,viewType,user.getUserId(), page);
        setAttr(ATTPage.PAGE_LIST,page);		
		return SUCCESS;
	}
	public String reportByDate(){
		UserInfo user = SessionHelper.getUserInfo();
		Page page = PagerFactory.createPage();
		adService.reportByDate(beginDate, endDate, user.getUserId(), page);
		setAttr(ATTPage.PAGE_LIST, page);
		return SUCCESS;
	}
	public String reportByAd(){
		UserInfo user = SessionHelper.getUserInfo();
		Page page = PagerFactory.createPage();
		adService.reportByAd(aar, beginDate, endDate,user.getUserId(), page);
		setAttr(ATTPage.PAGE_LIST, page);
		return SUCCESS;
	}
	public String reportByAdArea(){
		UserInfo user = SessionHelper.getUserInfo();
		Page page = PagerFactory.createPage();
		List<SysAreaInfo> list = adService.queryAreaInfo(user.getUserId());
		adService.reportByAdArea(area, beginDate, endDate,user.getUserId(),areaId, page);
		setAttr(ATTPage.PAGE_LIST,page);
		setAttr(BaseAttribute.LIST,list);
		return SUCCESS;
	}
	public String reportByApp(){
		UserInfo user = SessionHelper.getUserInfo();
		Page page = PagerFactory.createPage();
		adService.reportByApp(aar, beginDate, endDate, user.getUserId(),adName,page);
	    setAttr(ATTPage.PAGE_LIST, page);
		return SUCCESS;
	}
	
	
}